# Contributor: Dermot Bradley <dermot_bradley@yahoo.com>
# Maintainer: Dermot Bradley <dermot_bradley@yahoo.com>
pkgname=hd-idle
pkgver=1.16
pkgrel=2
pkgdesc="spin down idle hard disks"
url="https://github.com/adelolmo/hd-idle"
arch="all"
license="GPL-3.0-only"
makedepends="
	go
	"
subpackages="
	$pkgname-doc
	$pkgname-openrc
	"
options="!check" # There are no testcases
source="$pkgname-$pkgver.tar.gz::https://github.com/adelolmo/hd-idle/archive/v$pkgver.tar.gz
	hd-idle.confd
	hd-idle.initd
	hd-idle.logrotate
	"

build() {
	go build -o hd-idle hdidle.go main.go
}

package() {
	install -D -m755 hd-idle "$pkgdir"/usr/sbin/hd-idle

	install -m 644 -D "$srcdir"/hd-idle.confd "$pkgdir"/etc/conf.d/hd-idle
	install -m 755 -D "$srcdir"/hd-idle.initd "$pkgdir"/etc/init.d/hd-idle
	install -m 644 -D "$srcdir"/hd-idle.logrotate "$pkgdir"/etc/logrotate.d/hd-idle

	mkdir -p "$pkgdir"/usr/share/man/man8
	install -m644 \
		debian/hd-idle.8 \
		"$pkgdir"/usr/share/man/man8/
}

sha512sums="
ec2e1f79fddd027715fc9be1aa90ccf2db72bd351de478fd216309e1e2f4f7dbcf9d611620158b1464e539e6bcb458992c282a938e67923f14ba355af08dd362  hd-idle-1.16.tar.gz
9dfe8a4f4d23e6d5c360184b95fe432608185fe166efb71f959bab8cf86b02a0d87e83ec67fdf78304a0c2a770f36a3039a56df65213981f2b939967b337f9b8  hd-idle.confd
05b91cb405646ba897ec407df1eaf8ff6e735bd2cb8e3efb9fcacc7365aae2cd5f29f46c75599a53bfd7060132cf7559c7fd309f0ec80467bbea443183cb7fbe  hd-idle.initd
ec89ea63060c4684d892eae45ea686617620a966c873e863e9e7449418bc4d8c28e3175b050e89857c6ac4a969e71cebc99bba792e1e0c0af787fb246b0d9629  hd-idle.logrotate
"
